package com.sg.service.biz.framework.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.framework.req.*;
import com.sg.dto.biz.framework.res.*;
import com.sg.service.base.framework.*;
import com.sg.service.biz.framework.InductionRecordService;
import com.sg.service.biz.framework.MemberService;
import com.sg.service.biz.framework.OrgService;
import com.wicket.okrcomponent.integration.InterfaceModeService;
import com.wicket.okrcomponent.integration.MessageService;
import com.wicket.okrcomponent.integration.TemplateEngineService;
import com.wicket.okrcomponent.integration.dto.*;
import com.sg.common.exception.Assert;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.stream.Collectors;
//import com.wicket.okrframework.biz.service.dto.common.UsersDto;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class MessageServiceImpl
        implements com.wicket.okrframework.biz.service.MessageService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MUnionAppService mUnionAppService;
    @Resource
    private MInductionRecordService mInductionRecordService;
    @Resource
    private MUserinfoService mUserinfoService;
    //@Resource
    //private MCustomFields2Service mCustomFields2Service;
    @Resource
    private NbMessage nbMessage;
    @Resource
    private MemberService memberService;
    @Resource
    private MDepartSourceDataService mDepartSourceDataService;
    @Resource
    private MDeptService mDeptService;
    @Resource
    private MPersonSourceDataService mPersonSourceDataService;
    //@Resource
    //private undefinedService undefinedService;
    @Resource
    private OrgService orgService;
    @Resource
    private TemplateEngineService fwCompTemplateEngineClient;
    @Resource
    private MessageService fwCompMessageClient;
    @Resource
    private InterfaceModeService interfaceModeService;
    @Resource
    private InductionRecordService inductionRecordService;

    /**
     * D1-获取助手个人头像等信息(公共)[7321]
     * gen by moon at 12/29/2023, 7:07:25 PM
     */
    @Trace(operationName = "D1-获取助手个人头像等信息(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ObtainChannelAndMemberInfoComRespDto obtainChannelAndMemberInfoCom(ObtainChannelAndMemberInfoComReqDto reqDto) {


        QueryReceiveFieldDetailRespDto receptionServiceRes_1 = null;
//virtualUsage 1-2-06查当前租户联盟应用配置的发送人成员ID  47853
        UnionApp unionApp = null;
        QueryAppDetailReq queryAppDetailReq = new QueryAppDetailReq();
        if (reqDto != null) {
            queryAppDetailReq.setUniqueSpaceId(reqDto.getUniqueSpaceId());//SimpleFieldAssign//sourceId:1094519_1_47853
        }

        /*1-2-06查当前租户联盟应用配置的发送人成员ID[168]   */
        Assert.isNull(queryAppDetailReq.getUniqueSpaceId(), "D1-获取助手个人头像等信息(公共)-1-2-06查当前租户联盟应用配置的发送人成员ID-管理的空间ID不能为空", false);
        unionApp = mUnionAppService.queryAppDetail(queryAppDetailReq)/*vcase invoke 本地 method 方法调用;*/;


        if ((unionApp != null && unionApp != null && unionApp.getSenderMemberId() != null)) {
            //if((1-2-06查当前租户联盟应用配置的发送人成员ID.出参 值不等于空  and 1-2-06查当前租户联盟应用配置的发送人成员ID.配置消息发送人身份人员ID 值不等于空 ))  47863

            QueryInductionRecordDetailComBorderRespDto queryInductionRecordDetailComBorderRespDto = null;
            if (unionApp != null) {
                QueryInductionRecordDetailComBorderReqDto queryInductionRecordDetailComBorderReqDto = new QueryInductionRecordDetailComBorderReqDto();
                queryInductionRecordDetailComBorderReqDto.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:1449825_1_57704
                queryInductionRecordDetailComBorderReqDto.setIsMainInduction("TRUE");//sourceId:1449826_1_57704
                if (unionApp != null) {
                    queryInductionRecordDetailComBorderReqDto.setOriginalRoleMemberId(unionApp.getSenderMemberId());//SimpleFieldAssign//sourceId:1449824_1_57704
                    queryInductionRecordDetailComBorderReqDto.setSpaceId(unionApp.getUniqueSpaceId());//SimpleFieldAssign//sourceId:1449832_1_57704
                }

                /*D1-3查询就职记录详情(公共)(边界)[1340]   */
                Assert.isNull(queryInductionRecordDetailComBorderReqDto.getOriginalRoleMemberId(), "D1-获取助手个人头像等信息(公共)-D1-3查询就职记录详情(公共)(边界)-身份人员ID不能为空", false);
                Assert.isNull(queryInductionRecordDetailComBorderReqDto.getSubjectLifeCycle(), "D1-获取助手个人头像等信息(公共)-D1-3查询就职记录详情(公共)(边界)-主体生命周期不能为空", false);
                Assert.isNull(queryInductionRecordDetailComBorderReqDto.getIsMainInduction(), "D1-获取助手个人头像等信息(公共)-D1-3查询就职记录详情(公共)(边界)-是否主岗不能为空", false);
                queryInductionRecordDetailComBorderRespDto = inductionRecordService.queryInductionRecordDetailComBorder(queryInductionRecordDetailComBorderReqDto)/*vcase invoke isSameApp*/;


            }
//ModelCode: receptionService
            QueryReceiveFieldDetailRespDto receptionServiceRes = null;
            if (queryInductionRecordDetailComBorderRespDto != null && unionApp != null) {
                QueryReceiveFieldDetailReqDto receptionServiceReq = new QueryReceiveFieldDetailReqDto();
                receptionServiceReq.setIsAssistant("TRUE");//sourceId:1100883_1_47876
                receptionServiceReq.setMessageRole("assistant");//sourceId:1100884_1_47876
                if (queryInductionRecordDetailComBorderRespDto != null) {
                    receptionServiceReq.setSenderDeptId(queryInductionRecordDetailComBorderRespDto.getEntityId());//SimpleFieldAssign//sourceId:1449847_1_47876
                    receptionServiceReq.setSenderInductionRecordId(queryInductionRecordDetailComBorderRespDto.getInductionRecordId());//SimpleFieldAssign//sourceId:1449846_1_47876
                    receptionServiceReq.setSenderOriginalRoleMemberId(queryInductionRecordDetailComBorderRespDto.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:1100885_1_47876
                    receptionServiceReq.setSenderUserId(queryInductionRecordDetailComBorderRespDto.getUserId());//SimpleFieldAssign//sourceId:1100886_1_47876
                    receptionServiceReq.setSenderProfilePictureAddress(queryInductionRecordDetailComBorderRespDto.getUserFace());//SimpleFieldAssign//sourceId:1100887_1_47876
                    receptionServiceReq.setNameOfSender(queryInductionRecordDetailComBorderRespDto.getIdCardName());//SimpleFieldAssign//sourceId:1100888_1_47876
                }
                if (unionApp != null) {
                    receptionServiceReq.setSenderSpaceId(unionApp.getUniqueSpaceId());//SimpleFieldAssign//sourceId:1449850_1_47876
                    receptionServiceReq.setSenderAppId(unionApp.getAscriptionAppId());//SimpleFieldAssign//sourceId:1449851_1_47876
                }

                /*M1接收上文出参发送人字段[3715]  用于特殊方法接收上游入参。 */
                Assert.isNull(receptionServiceReq.getIsAssistant(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方是否助手不能为空", false);
                Assert.isNull(receptionServiceReq.getMessageRole(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方角色不能为空", false);
                Assert.isNull(receptionServiceReq.getSenderDeptId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方就职部门ID不能为空", false);
                Assert.isNull(receptionServiceReq.getSenderInductionRecordId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方就职记录ID不能为空", false);
                Assert.isNull(receptionServiceReq.getSenderOriginalRoleMemberId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方身份人员ID不能为空", false);
                Assert.isNull(receptionServiceReq.getSenderUserId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方账号ID不能为空", false);
                Assert.isNull(receptionServiceReq.getSenderProfilePictureAddress(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方头像地址不能为空", false);
                Assert.isNull(receptionServiceReq.getNameOfSender(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方姓名不能为空", false);
                Assert.isNull(receptionServiceReq.getSenderSpaceId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方空间ID不能为空", false);
                Assert.isNull(receptionServiceReq.getSenderAppId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方联盟应用ID不能为空", false);
                receptionServiceRes = nbMessage.queryReceiveFieldDetail(receptionServiceReq);


                receptionServiceRes_1 = receptionServiceRes;
            }
        } else if ((unionApp != null && unionApp.getSenderMemberId() == null)) {
            //elseif(1-2-06查当前租户联盟应用配置的发送人成员ID.配置消息发送人身份人员ID 值等于空 )  47865

            UnionApp unionApp_2 = null;
            if (unionApp != null) {
                QueryAppDetailReq queryAppDetailReq_1 = new QueryAppDetailReq();
                queryAppDetailReq_1.setPlatformType("TRUE");//sourceId:1094521_1_47866
                if (unionApp != null) {
                    queryAppDetailReq_1.setAppId(unionApp.getAscriptionAppId());//SimpleFieldAssign//sourceId:1094520_1_47866
                }

                /*1-2-06查询平台联盟应用配置的发送人成员ID[168]   */
                Assert.isNull(queryAppDetailReq_1.getAppId(), "D1-获取助手个人头像等信息(公共)-1-2-06查询平台联盟应用配置的发送人成员ID-应用ID不能为空", false);
                Assert.isNull(queryAppDetailReq_1.getPlatformType(), "D1-获取助手个人头像等信息(公共)-1-2-06查询平台联盟应用配置的发送人成员ID-是否平台应用不能为空", false);
                unionApp_2 = mUnionAppService.queryAppDetail(queryAppDetailReq_1)/*vcase invoke 本地 method 方法调用;*/;


            }
            if ((unionApp_2 != null && unionApp_2 != null && unionApp_2.getSenderMemberId() != null)) {
                //if((1-2-06查询平台联盟应用配置的发送人成员ID.出参 值不等于空  and 1-2-06查询平台联盟应用配置的发送人成员ID.配置消息发送人身份人员ID 值不等于空 ))  47869

                QueryInductionRecordDetailComBorderRespDto queryInductionRecordDetailComBorderRespDto_2 = null;
                if (unionApp_2 != null) {
                    QueryInductionRecordDetailComBorderReqDto queryInductionRecordDetailComBorderReqDto_1 = new QueryInductionRecordDetailComBorderReqDto();
                    queryInductionRecordDetailComBorderReqDto_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:1449825_1_57705
                    queryInductionRecordDetailComBorderReqDto_1.setIsMainInduction("TRUE");//sourceId:1449826_1_57705
                    if (unionApp_2 != null) {
                        queryInductionRecordDetailComBorderReqDto_1.setOriginalRoleMemberId(unionApp_2.getSenderMemberId());//SimpleFieldAssign//sourceId:1449824_1_57705
                    }

                    /*D1-3查询就职记录详情(公共)(边界)[1340]   */
                    Assert.isNull(queryInductionRecordDetailComBorderReqDto_1.getOriginalRoleMemberId(), "D1-获取助手个人头像等信息(公共)-D1-3查询就职记录详情(公共)(边界)-身份人员ID不能为空", false);
                    Assert.isNull(queryInductionRecordDetailComBorderReqDto_1.getSubjectLifeCycle(), "D1-获取助手个人头像等信息(公共)-D1-3查询就职记录详情(公共)(边界)-主体生命周期不能为空", false);
                    Assert.isNull(queryInductionRecordDetailComBorderReqDto_1.getIsMainInduction(), "D1-获取助手个人头像等信息(公共)-D1-3查询就职记录详情(公共)(边界)-是否主岗不能为空", false);
                    queryInductionRecordDetailComBorderRespDto_2 = inductionRecordService.queryInductionRecordDetailComBorder(queryInductionRecordDetailComBorderReqDto_1)/*vcase invoke isSameApp*/;


                }
//ModelCode: receptionService
                QueryReceiveFieldDetailRespDto receptionServiceRes_2 = null;
                if (queryInductionRecordDetailComBorderRespDto_2 != null && unionApp != null) {
                    QueryReceiveFieldDetailReqDto receptionServiceReq_1 = new QueryReceiveFieldDetailReqDto();
                    receptionServiceReq_1.setIsAssistant("TRUE");//sourceId:1100883_1_47880
                    receptionServiceReq_1.setMessageRole("assistant");//sourceId:1100884_1_47880
                    if (queryInductionRecordDetailComBorderRespDto_2 != null) {
                        receptionServiceReq_1.setSenderDeptId(queryInductionRecordDetailComBorderRespDto_2.getEntityId());//SimpleFieldAssign//sourceId:1449847_1_47880
                        receptionServiceReq_1.setSenderInductionRecordId(queryInductionRecordDetailComBorderRespDto_2.getInductionRecordId());//SimpleFieldAssign//sourceId:1449846_1_47880
                        receptionServiceReq_1.setSenderOriginalRoleMemberId(queryInductionRecordDetailComBorderRespDto_2.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:1100885_1_47880
                        receptionServiceReq_1.setSenderUserId(queryInductionRecordDetailComBorderRespDto_2.getUserId());//SimpleFieldAssign//sourceId:1100886_1_47880
                        receptionServiceReq_1.setSenderProfilePictureAddress(queryInductionRecordDetailComBorderRespDto_2.getUserFace());//SimpleFieldAssign//sourceId:1100887_1_47880
                        receptionServiceReq_1.setNameOfSender(queryInductionRecordDetailComBorderRespDto_2.getIdCardName());//SimpleFieldAssign//sourceId:1100888_1_47880
                    }
                    if (unionApp != null) {
                        receptionServiceReq_1.setSenderSpaceId(unionApp.getUniqueSpaceId());//SimpleFieldAssign//sourceId:1449850_1_47880
                        receptionServiceReq_1.setSenderAppId(unionApp.getAscriptionAppId());//SimpleFieldAssign//sourceId:1449851_1_47880
                    }

                    /*M1接收上文出参发送人字段[3715]  用于特殊方法接收上游入参。 */
                    Assert.isNull(receptionServiceReq_1.getIsAssistant(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方是否助手不能为空", false);
                    Assert.isNull(receptionServiceReq_1.getMessageRole(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方角色不能为空", false);
                    Assert.isNull(receptionServiceReq_1.getSenderDeptId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方就职部门ID不能为空", false);
                    Assert.isNull(receptionServiceReq_1.getSenderInductionRecordId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方就职记录ID不能为空", false);
                    Assert.isNull(receptionServiceReq_1.getSenderOriginalRoleMemberId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方身份人员ID不能为空", false);
                    Assert.isNull(receptionServiceReq_1.getSenderUserId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方账号ID不能为空", false);
                    Assert.isNull(receptionServiceReq_1.getSenderProfilePictureAddress(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方头像地址不能为空", false);
                    Assert.isNull(receptionServiceReq_1.getNameOfSender(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方姓名不能为空", false);
                    Assert.isNull(receptionServiceReq_1.getSenderSpaceId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方空间ID不能为空", false);
                    Assert.isNull(receptionServiceReq_1.getSenderAppId(), "D1-获取助手个人头像等信息(公共)-M1接收上文出参发送人字段-发送方联盟应用ID不能为空", false);
                    receptionServiceRes_2 = nbMessage.queryReceiveFieldDetail(receptionServiceReq_1);


                    receptionServiceRes_1 = receptionServiceRes_2;
                }
            }
        }
        ObtainChannelAndMemberInfoComRespDto retData = new ObtainChannelAndMemberInfoComRespDto();
        if (receptionServiceRes_1 != null) {
            retData.setIsAssistant(receptionServiceRes_1.getIsAssistant());//SimpleFieldAssign//sourceId:1100981_1
            retData.setMessageRole(receptionServiceRes_1.getMessageRole());//SimpleFieldAssign//sourceId:1100982_1
            retData.setSenderOriginalRoleMemberId(receptionServiceRes_1.getSenderOriginalRoleMemberId());//SimpleFieldAssign//sourceId:1100983_1
            retData.setSenderUserId(receptionServiceRes_1.getSenderUserId());//SimpleFieldAssign//sourceId:1100984_1
            retData.setSenderInductionRecordId(receptionServiceRes_1.getSenderInductionRecordId());//SimpleFieldAssign//sourceId:1449853_1
            retData.setSenderProfilePictureAddress(receptionServiceRes_1.getSenderProfilePictureAddress());//SimpleFieldAssign//sourceId:1100985_1
            retData.setNameOfSender(receptionServiceRes_1.getNameOfSender());//SimpleFieldAssign//sourceId:1100986_1
            retData.setSenderDeptId(receptionServiceRes_1.getSenderDeptId());//SimpleFieldAssign//sourceId:1449852_1
            retData.setSenderSpaceId(receptionServiceRes_1.getSenderSpaceId());//SimpleFieldAssign//sourceId:1100987_1
            retData.setSenderAppId(receptionServiceRes_1.getSenderAppId());//SimpleFieldAssign//sourceId:1100988_1
        }


        return retData;
    }

    /**
     * D1执行给部门管理者发通知(公共)[7538]
     * gen by moon at 12/27/2023, 3:54:00 AM
     */
    @Trace(operationName = "D1执行给部门管理者发通知(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementToDeptManagerSendMsgComRespDto implementToDeptManagerSendMsgCom(ImplementToDeptManagerSendMsgComReqDto reqDto) {


        if ((reqDto != null && reqDto.getDeptList() != null && reqDto.getDeptList().size() > 0)) {
            //if(D1执行给部门管理者发通知(公共).部门列表数据集条数 大于 0)  50106

            QueryMemberProfileDetailComRespDto queryMemberProfileDetailComRespDto = null;
            QueryMemberProfileDetailComReqDto queryMemberProfileDetailComReqDto = new QueryMemberProfileDetailComReqDto();
            queryMemberProfileDetailComReqDto.setOriginalRoleMemberId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecOriginalRoleMemberId());//CURRENT_ORIGINAL_ROLE_MEMBERID//sourceId:1176575_1_50121
            queryMemberProfileDetailComReqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1176576_1_50121

            /*D1查询发起方个人资料详情(公共)[6778]   */
            Assert.isNull(queryMemberProfileDetailComReqDto.getOriginalRoleMemberId(), "D1执行给部门管理者发通知(公共)-D1查询发起方个人资料详情(公共)-身份人员ID不能为空", false);
            Assert.isNull(queryMemberProfileDetailComReqDto.getSpaceId(), "D1执行给部门管理者发通知(公共)-D1查询发起方个人资料详情(公共)-创建于空间ID不能为空", false);
            queryMemberProfileDetailComRespDto = memberService.queryMemberProfileDetailCom(queryMemberProfileDetailComReqDto)/*vcase invoke isSameApp*/;


//ModelCode: circulationCollections
            for (DeptDto circulationCollectionsRes : reqDto.getDeptList()) {

                Dept dept = null;
                QueryDeptDetailReq queryDeptDetailReq = new QueryDeptDetailReq();
                if (circulationCollectionsRes != null) {
                    queryDeptDetailReq.setDeptId(circulationCollectionsRes.getDeptId());//SimpleFieldAssign//sourceId:1177511_1_50136
                }

                /*1-3-09查询部门简称[218]   */
                Assert.isNull(queryDeptDetailReq.getDeptId(), "D1执行给部门管理者发通知(公共)-1-3-09查询部门简称-部门ID不能为空", false);
                dept = mDeptService.queryDeptDetail(queryDeptDetailReq)/*vcase invoke 本地 method 方法调用;*/;


                QueryDeptAdminAndDeputyListComRespDto queryDeptAdminAndDeputyListComRespDto = null;
                QueryDeptAdminAndDeputyListComReqDto queryDeptAdminAndDeputyListComReqDto = new QueryDeptAdminAndDeputyListComReqDto();
                if (reqDto != null) {
                    queryDeptAdminAndDeputyListComReqDto.setDeptDeputyCondition(reqDto.getDeptDeputyCondition());//SimpleFieldAssign//sourceId:1176521_1_50112
                    queryDeptAdminAndDeputyListComReqDto.setPrivacyCode(reqDto.getPrivacyCode());//SimpleFieldAssign//sourceId:1176523_1_50112
                }
                if (circulationCollectionsRes != null) {
                    queryDeptAdminAndDeputyListComReqDto.setDeptId(circulationCollectionsRes.getDeptId());//SimpleFieldAssign//sourceId:1176522_1_50112
                }

                /*D1查部门管理员及正副职(公共)[7537]   */
                Assert.isNull(queryDeptAdminAndDeputyListComReqDto.getDeptDeputyCondition(), "D1执行给部门管理者发通知(公共)-D1查部门管理员及正副职(公共)-部门管理者获取条件不能为空", false);
                Assert.isNull(queryDeptAdminAndDeputyListComReqDto.getDeptId(), "D1执行给部门管理者发通知(公共)-D1查部门管理员及正副职(公共)-部门ID不能为空", false);
                Assert.isNull(queryDeptAdminAndDeputyListComReqDto.getPrivacyCode(), "D1执行给部门管理者发通知(公共)-D1查部门管理员及正副职(公共)-权限标识不能为空", false);
                queryDeptAdminAndDeputyListComRespDto = orgService.queryDeptAdminAndDeputyListCom(queryDeptAdminAndDeputyListComReqDto)/*vcase invoke isSameApp*/;


                GenerateMsgTitleAndContentComRespDto generateMsgTitleAndContentComRespDto = null;
                if (dept != null) {
                    GenerateMsgTitleAndContentComReqDto generateMsgTitleAndContentComReqDto = new GenerateMsgTitleAndContentComReqDto();
                    generateMsgTitleAndContentComReqDto.setInputNum(Long.valueOf(0));//CUSTOM_CONVENTION//sourceId:1176699_1_50123
                    if (reqDto != null) {
                        generateMsgTitleAndContentComReqDto.setTemplateSemanticEngineCode(reqDto.getTemplateSemanticEngineCode());//SimpleFieldAssign//sourceId:1176703_1_50123
                    }
                    if (circulationCollectionsRes != null) {
                        generateMsgTitleAndContentComReqDto.setComNumField(circulationCollectionsRes.getComNumField());//SimpleFieldAssign//sourceId:1177855_1_50123
                    }
                    if (dept != null) {
                        generateMsgTitleAndContentComReqDto.setTargetContentName(dept.getDeptShortName());//SimpleFieldAssign//sourceId:1176702_1_50123
                    }

                    /*D2生成消息标题及内容(公共)[7489]   */
                    Assert.isNull(generateMsgTitleAndContentComReqDto.getTemplateSemanticEngineCode(), "D1执行给部门管理者发通知(公共)-D2生成消息标题及内容(公共)-模板引擎标识不能为空", false);
                    Assert.isNull(generateMsgTitleAndContentComReqDto.getTargetContentName(), "D1执行给部门管理者发通知(公共)-D2生成消息标题及内容(公共)-目标内容名称不能为空", false);
                    Assert.isNull(generateMsgTitleAndContentComReqDto.getInputNum(), "D1执行给部门管理者发通知(公共)-D2生成消息标题及内容(公共)-消息标题保留长度不能为空", false);
                    generateMsgTitleAndContentComRespDto = fwCompTemplateEngineClient.generateMsgTitleAndContentCom(generateMsgTitleAndContentComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


                }
                if ((queryDeptAdminAndDeputyListComRespDto != null && queryDeptAdminAndDeputyListComRespDto.getDeptAdminAndDeputyList() != null && queryDeptAdminAndDeputyListComRespDto.getDeptAdminAndDeputyList().size() > 0)) {
                    //if(D1查部门管理员及正副职(公共).部门管理员及正副职列表数据集条数 大于 0)  50115

//ModelCode: circulationCollections
                    for (DeptAdminAndDeputyDto circulationCollectionsRes_2 : queryDeptAdminAndDeputyListComRespDto.getDeptAdminAndDeputyList()) {

                        ImplementSendMessageChannelComRespDto implementSendMessageChannelComRespDto = null;
                        if (queryMemberProfileDetailComRespDto != null && generateMsgTitleAndContentComRespDto != null) {
                            ImplementSendMessageChannelComReqDto implementSendMessageChannelComReqDto = new ImplementSendMessageChannelComReqDto();
                            implementSendMessageChannelComReqDto.setUseChannelMethod("ISHAVE_MEMBER_CHANNEL");//sourceId:1176592_1_50118
                            implementSendMessageChannelComReqDto.setMessageTemplateCode("TWO_PEOPLE_CHAT_DEFAULT_PROMPT_MESSAGE");//CUSTOM_CONVENTION//sourceId:1176582_1_50118
                            implementSendMessageChannelComReqDto.setMessageLocationTypeCode("TENANT_USER_CENTER");//CUSTOM_CONVENTION//sourceId:1176581_1_50118
                            implementSendMessageChannelComReqDto.setMessagePromptType("NUMBER_TYPE");//sourceId:1176588_1_50118
                            implementSendMessageChannelComReqDto.setPlatformReplace("FALSE");//sourceId:1176583_1_50118
                            implementSendMessageChannelComReqDto.setMsgChannelClassCode("NOTIFICATION_ANNOUNCEMENT");//sourceId:1444903_1_50118
                            implementSendMessageChannelComReqDto.setChannelTypeCode("PERSONAL_SESSION");//sourceId:1176617_1_50118
                            implementSendMessageChannelComReqDto.setNewTableTypeCode("OMS_FRAMEWORK_ORIGINAL_ROLE_MEMBER");//sourceId:1176590_1_50118
                            implementSendMessageChannelComReqDto.setNewEntityId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecOriginalRoleMemberId());//CURRENT_ORIGINAL_ROLE_MEMBERID//sourceId:1176591_1_50118
                            implementSendMessageChannelComReqDto.setChannelSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1176612_1_50118
                            implementSendMessageChannelComReqDto.setChannelAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID//sourceId:1176613_1_50118
                            implementSendMessageChannelComReqDto.setMessageImportantLevel(Long.valueOf(4));//CUSTOM_CONVENTION//sourceId:1176587_1_50118
                            implementSendMessageChannelComReqDto.setConTableTypeCode("OMS_FRAMEWORK_ORIGINAL_ROLE_MEMBER");//sourceId:1176608_1_50118
                            implementSendMessageChannelComReqDto.setConEntityId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecOriginalRoleMemberId());//CURRENT_ORIGINAL_ROLE_MEMBERID//sourceId:1176609_1_50118
                            implementSendMessageChannelComReqDto.setBorcScene("TOB_SCENE");//sourceId:1176593_1_50118
                            implementSendMessageChannelComReqDto.setMessageRole("user");//sourceId:1176594_1_50118
                            implementSendMessageChannelComReqDto.setIsAssistant("FALSE");//sourceId:1176606_1_50118
                            implementSendMessageChannelComReqDto.setSenderOriginalRoleMemberId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecOriginalRoleMemberId());//CURRENT_ORIGINAL_ROLE_MEMBERID//sourceId:1176595_1_50118
                            implementSendMessageChannelComReqDto.setSenderUserId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecUserId());//CURRENT_USERID//sourceId:1176596_1_50118
                            implementSendMessageChannelComReqDto.setSenderSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1176598_1_50118
                            implementSendMessageChannelComReqDto.setSenderAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID//sourceId:1176599_1_50118
                            implementSendMessageChannelComReqDto.setHandleType("NO_NEED_HANDLING");//sourceId:1442783_1_50118
                            implementSendMessageChannelComReqDto.setReceiveSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:1176602_1_50118
                            implementSendMessageChannelComReqDto.setReceiveAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID//sourceId:1176603_1_50118
                            implementSendMessageChannelComReqDto.setComNumField(Long.valueOf(2));//CUSTOM_CONVENTION//sourceId:1176597_1_50118
                            implementSendMessageChannelComReqDto.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME//sourceId:1176618_1_50118
                            if (queryMemberProfileDetailComRespDto != null) {
                                implementSendMessageChannelComReqDto.setChannelLogo(queryMemberProfileDetailComRespDto.getUserFace());//SimpleFieldAssign//sourceId:1176610_1_50118
                                implementSendMessageChannelComReqDto.setChannelName(queryMemberProfileDetailComRespDto.getIdCardName());//SimpleFieldAssign//sourceId:1176611_1_50118
                                implementSendMessageChannelComReqDto.setSenderProfilePictureAddress(queryMemberProfileDetailComRespDto.getUserFace());//SimpleFieldAssign//sourceId:1176584_1_50118
                                implementSendMessageChannelComReqDto.setNameOfSender(queryMemberProfileDetailComRespDto.getIdCardName());//SimpleFieldAssign//sourceId:1176585_1_50118
                            }
                            if (generateMsgTitleAndContentComRespDto != null) {
                                implementSendMessageChannelComReqDto.setMessageTitle(generateMsgTitleAndContentComRespDto.getMsgTitle());//SimpleFieldAssign//sourceId:1177844_1_50118
                                implementSendMessageChannelComReqDto.setObjectName(generateMsgTitleAndContentComRespDto.getMsgContent());//SimpleFieldAssign//sourceId:1176586_1_50118
                                implementSendMessageChannelComReqDto.setNewMessage(generateMsgTitleAndContentComRespDto.getMsgContent());//SimpleFieldAssign//sourceId:1338701_1_50118
                            }
                            if (circulationCollectionsRes_2 != null) {
                                implementSendMessageChannelComReqDto.setReceiveOriginalRoleMemberId(circulationCollectionsRes_2.getOriginalRoleMemberId());//SimpleFieldAssign//sourceId:1176604_1_50118
                                implementSendMessageChannelComReqDto.setReceiveUserId(circulationCollectionsRes_2.getUserId());//SimpleFieldAssign//sourceId:1176605_1_50118
                                implementSendMessageChannelComReqDto.setReceiveProfilePictureAddress(circulationCollectionsRes_2.getUserFace());//SimpleFieldAssign//sourceId:1176600_1_50118
                                implementSendMessageChannelComReqDto.setNameOfReceive(circulationCollectionsRes_2.getIdCardName());//SimpleFieldAssign//sourceId:1176601_1_50118
                            }

                            /*D2执行发送消息到通道(公共)[6814]   */
                            Assert.isNull(implementSendMessageChannelComReqDto.getUseChannelMethod(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-使用通道方式不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getMessageTemplateCode(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-消息模板标识不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getMessageLocationTypeCode(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-消息位置标识不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getMessagePromptType(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-消息提示类型不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getPlatformReplace(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-是否平台代操作不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getMsgChannelClassCode(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-消息使用通道类别不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getChannelTypeCode(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-通道类型编码不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getChannelLogo(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-通道缩略图地址不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getChannelName(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-通道名称不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getNewTableTypeCode(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-通道归属主体内容类型编码不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getNewEntityId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-通道归属主体内容ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getChannelSpaceId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-通道归属空间ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getChannelAppId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-通道归属联盟应用ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getMessageImportantLevel(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-消息重要紧急度层级不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getConTableTypeCode(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-内容表编码不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getConEntityId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-内容表主键ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getMessageTitle(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-消息标题不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getObjectName(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-对象名称不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getNewMessage(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-最新消息文本不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getBorcScene(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-toB或toC场景不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getMessageRole(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-发送方角色不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getIsAssistant(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-发送方是否助手不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getSenderOriginalRoleMemberId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-发送方身份人员ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getSenderUserId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-发送方账号ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getSenderProfilePictureAddress(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-发送方头像地址不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getNameOfSender(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-发送方姓名不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getSenderSpaceId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-发送方空间ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getSenderAppId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-发送方联盟应用ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getHandleType(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-处理类型不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getReceiveOriginalRoleMemberId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-接收方身份人员ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getReceiveUserId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-接收方账号ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getReceiveProfilePictureAddress(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-接收方头像地址不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getNameOfReceive(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-接收方姓名不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getReceiveSpaceId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-接收方空间ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getReceiveAppId(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-接收方联盟应用ID不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getComNumField(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-通用数值字段（整数型）不能为空", false);
                            Assert.isNull(implementSendMessageChannelComReqDto.getOperateTime(), "D1执行给部门管理者发通知(公共)-D2执行发送消息到通道(公共)-操作时间不能为空", false);
                            implementSendMessageChannelComRespDto = fwCompMessageClient.implementSendMessageChannelCom(implementSendMessageChannelComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


                        }
//ModelCode: circulationEnd
                    }

                }
                ImplementSendTrigonalServeMsgComRespDto implementSendTrigonalServeMsgComRespDto = null;
                if (queryDeptAdminAndDeputyListComRespDto != null && generateMsgTitleAndContentComRespDto != null) {
                    ImplementSendTrigonalServeMsgComReqDto implementSendTrigonalServeMsgComReqDto = new ImplementSendTrigonalServeMsgComReqDto();
                    if (queryDeptAdminAndDeputyListComRespDto != null && queryDeptAdminAndDeputyListComRespDto.getDeptAdminAndDeputyList() != null && !CollectionUtil.isEmpty(queryDeptAdminAndDeputyListComRespDto.getDeptAdminAndDeputyList())) {
                        implementSendTrigonalServeMsgComReqDto.setTripartiteMsgAccepterList(queryDeptAdminAndDeputyListComRespDto.getDeptAdminAndDeputyList().stream().map(item -> item.getRoleMemberCode())
                                .collect(Collectors.toList()));/*list-to-strings*///sourceId:1176707_1_50127
                    }
                    if (generateMsgTitleAndContentComRespDto != null) {
                        implementSendTrigonalServeMsgComReqDto.setMessageTitle(generateMsgTitleAndContentComRespDto.getMsgTitle());//SimpleFieldAssign//sourceId:1176708_1_50127
                        implementSendTrigonalServeMsgComReqDto.setMessageContent(generateMsgTitleAndContentComRespDto.getMsgContent());//SimpleFieldAssign//sourceId:1176709_1_50127
                    }

                    /*D2-执行发送三方服务消息(公共)[7396]   */
                    Assert.isNull(implementSendTrigonalServeMsgComReqDto.getMessageTitle(), "D1执行给部门管理者发通知(公共)-D2-执行发送三方服务消息(公共)-消息标题不能为空", false);
                    Assert.isNull(implementSendTrigonalServeMsgComReqDto.getMessageContent(), "D1执行给部门管理者发通知(公共)-D2-执行发送三方服务消息(公共)-消息内容不能为空", false);
                    implementSendTrigonalServeMsgComRespDto = fwCompMessageClient.implementSendTrigonalServeMsgCom(implementSendTrigonalServeMsgComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


                }
                ImplementSendThirdSmsComRespDto implementSendThirdSmsComRespDto = null;
                if (queryDeptAdminAndDeputyListComRespDto != null && generateMsgTitleAndContentComRespDto != null && dept != null) {
                    ImplementSendThirdSmsComReqDto implementSendThirdSmsComReqDto = new ImplementSendThirdSmsComReqDto();
                    if (queryDeptAdminAndDeputyListComRespDto != null && queryDeptAdminAndDeputyListComRespDto.getDeptAdminAndDeputyList() != null && !CollectionUtil.isEmpty(queryDeptAdminAndDeputyListComRespDto.getDeptAdminAndDeputyList())) {
                        implementSendThirdSmsComReqDto.setUsersList(queryDeptAdminAndDeputyListComRespDto.getDeptAdminAndDeputyList().stream().map(item -> BeanUtil.toBean(item, UsersDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1176711_1_50128
                    }
                    if (reqDto != null) {
                        implementSendThirdSmsComReqDto.setSmsBehaviorType(reqDto.getSmsBehaviorType());//SimpleFieldAssign//sourceId:1176714_1_50128
                    }
//if(generateMsgTitleAndContentComRespDto!=null){
//      implementSendThirdSmsComReqDto.setSmsContent(generateMsgTitleAndContentComRespDto.getMsgContent());//SimpleFieldAssign//sourceId:1176710_1_50128
//    }
                    if (circulationCollectionsRes != null) {
//      implementSendThirdSmsComReqDto.setComNumField(circulationCollectionsRes.getComNumField());//SimpleFieldAssign//sourceId:1178312_1_50128
                    }
                    if (dept != null) {
//      implementSendThirdSmsComReqDto.setTargetContentName(dept.getDeptShortName());//SimpleFieldAssign//sourceId:1177569_1_50128
                    }

                    /*D2执行发送三方短信(公共)[7496]   */
                    Assert.isNull(implementSendThirdSmsComReqDto.getSmsBehaviorType(), "D1执行给部门管理者发通知(公共)-D2执行发送三方短信(公共)-短信行为类型不能为空", false);
//Assert.isNull(implementSendThirdSmsComReqDto.getTargetContentName(),"D1执行给部门管理者发通知(公共)-D2执行发送三方短信(公共)-目标内容名称不能为空",false);
                    implementSendThirdSmsComRespDto = fwCompMessageClient.implementSendThirdSmsCom(implementSendThirdSmsComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


                }
//ModelCode: circulationEnd
            }

        }
        ImplementToDeptManagerSendMsgComRespDto retData = new ImplementToDeptManagerSendMsgComRespDto();


        return retData;
    }

    /**
     * D1获取组织成员消息接收人信息(公共)[7972]
     * gen by moon at 12/19/2023, 6:55:00 PM
     */
    @Trace(operationName = "D1获取组织成员消息接收人信息(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ObtainOrgMemberMsgReceiveInfoComRespDto obtainOrgMemberMsgReceiveInfoCom(ObtainOrgMemberMsgReceiveInfoComReqDto reqDto) {


        BatchQueryMemberProfileListByIdsComRespDto batchQueryMemberProfileListByIdsComRespDto_1 = null;
//virtualUsage D2将消息接收人范围去重相同的人  56993
        ImplementManyFieldsDataSetDuplicateRemovalComRespDto implementManyFieldsDataSetDuplicateRemovalComRespDto = null;
        ImplementManyFieldsDataSetDuplicateRemovalComReqDto implementManyFieldsDataSetDuplicateRemovalComReqDto = new ImplementManyFieldsDataSetDuplicateRemovalComReqDto();
        if (reqDto != null) {
            //simpleList-to-objLists
            for (String item : reqDto.getBeginMemberList()) {
                DataSetDuplicateRemovalDto oneItem = new DataSetDuplicateRemovalDto();
                if (reqDto != null) {
                    oneItem.setCommPrimaryKey(item);//SimpleFieldAssign//sourceId:270202_2_56993
                }

                implementManyFieldsDataSetDuplicateRemovalComReqDto.getDataSetDuplicateRemovalList().add(oneItem);
            }//sourceId:1326107_1_56993
        }

        /*D2将消息接收人范围去重相同的人[7323]   */

        implementManyFieldsDataSetDuplicateRemovalComRespDto = interfaceModeService.implementManyFieldsDataSetDuplicateRemovalCom(implementManyFieldsDataSetDuplicateRemovalComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        if ((implementManyFieldsDataSetDuplicateRemovalComRespDto != null && implementManyFieldsDataSetDuplicateRemovalComRespDto.getDataSetDuplicateRemovalList() != null && implementManyFieldsDataSetDuplicateRemovalComRespDto.getDataSetDuplicateRemovalList().size() > 0)) {
            //if(D2将消息接收人范围去重相同的人.数据集记录去重列表数据集条数 大于 0)  54115

            ImplementMutDataToOneDatasComRespDto implementMutDataToOneDatasComRespDto = null;
            ImplementMutDataToOneDatasComReqDto implementMutDataToOneDatasComReqDto = new ImplementMutDataToOneDatasComReqDto();
            if (reqDto != null) {
                implementMutDataToOneDatasComReqDto.setCustomField1(reqDto.getSenderOriginalRoleMemberId());//SimpleFieldAssign//sourceId:1420069_1_56744
            }

            /*D2将消息发送人账号信息转数据集[5864]   */
            Assert.isNull(implementMutDataToOneDatasComReqDto.getCustomField1(), "D1获取组织成员消息接收人信息(公共)-D2将消息发送人账号信息转数据集-自定义字段1不能为空", false);
            implementMutDataToOneDatasComRespDto = interfaceModeService.implementMutDataToOneDatasCom(implementMutDataToOneDatasComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            ImplementTwoDataRemovalExistsComRespDto implementTwoDataRemovalExistsComRespDto = null;
            if (implementManyFieldsDataSetDuplicateRemovalComRespDto != null && implementMutDataToOneDatasComRespDto != null) {
                ImplementTwoDataRemovalExistsComReqDto implementTwoDataRemovalExistsComReqDto = new ImplementTwoDataRemovalExistsComReqDto();
                if (implementManyFieldsDataSetDuplicateRemovalComRespDto != null && implementManyFieldsDataSetDuplicateRemovalComRespDto.getDataSetDuplicateRemovalList() != null && !CollectionUtil.isEmpty(implementManyFieldsDataSetDuplicateRemovalComRespDto.getDataSetDuplicateRemovalList())) {
                    implementTwoDataRemovalExistsComReqDto.setDataSetsListOne(//objList-to-objLists
                            implementManyFieldsDataSetDuplicateRemovalComRespDto.getDataSetDuplicateRemovalList().stream().map(item -> {
                                DataSetsListOneDto elm = new DataSetsListOneDto();
                                if (item != null) {
                                    elm.setCustomField(item.getCommPrimaryKey());//SimpleFieldAssign//sourceId:270196_2_54117
                                }
                                return elm;
                            }).collect(Collectors.toList()));//objList-to-objLists//sourceId:1326104_1_54117
                }
                if (implementMutDataToOneDatasComRespDto != null) {
                    //simpleList-to-objLists
                    for (String item : implementMutDataToOneDatasComRespDto.getComDatasList()) {
                        DataSetsListTwoDto oneItem = new DataSetsListTwoDto();
                        if (implementMutDataToOneDatasComRespDto != null) {
                            oneItem.setCustomField(item);//SimpleFieldAssign//sourceId:270198_2_54117
                        }

                        implementTwoDataRemovalExistsComReqDto.getDataSetsListTwo().add(oneItem);
                    }//sourceId:1326105_1_54117
                }

                /*D2执行员工数据集去除发送人[5347]   */

                implementTwoDataRemovalExistsComRespDto = interfaceModeService.implementTwoDataRemovalExistsCom(implementTwoDataRemovalExistsComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


            }
            BatchQueryMemberProfileListByIdsComRespDto batchQueryMemberProfileListByIdsComRespDto = null;
            if (implementTwoDataRemovalExistsComRespDto != null) {
                BatchQueryMemberProfileListByIdsComReqDto batchQueryMemberProfileListByIdsComReqDto = new BatchQueryMemberProfileListByIdsComReqDto();
                if (implementTwoDataRemovalExistsComRespDto != null && implementTwoDataRemovalExistsComRespDto.getTwoDataRemovalExistsList() != null && !CollectionUtil.isEmpty(implementTwoDataRemovalExistsComRespDto.getTwoDataRemovalExistsList())) {
                    batchQueryMemberProfileListByIdsComReqDto.setBeginMemberList(implementTwoDataRemovalExistsComRespDto.getTwoDataRemovalExistsList().stream().map(item -> item.getCustomField())
                            .collect(Collectors.toList()));/*list-to-strings*///sourceId:1326109_1_54119
                }

                /*D1批量查消息接收人信息列表[7492]   */

                batchQueryMemberProfileListByIdsComRespDto = memberService.batchQueryMemberProfileListByIdsCom(batchQueryMemberProfileListByIdsComReqDto)/*vcase invoke isSameApp*/;


                batchQueryMemberProfileListByIdsComRespDto_1 = batchQueryMemberProfileListByIdsComRespDto;
            }
        }
        ObtainOrgMemberMsgReceiveInfoComRespDto retData = new ObtainOrgMemberMsgReceiveInfoComRespDto();
        if (batchQueryMemberProfileListByIdsComRespDto_1 != null) {
            retData.setMemberMsgReceiveList(batchQueryMemberProfileListByIdsComRespDto_1.getBeginMemberList().stream().map(item -> BeanUtil.toBean(item, MemberMsgReceiveDto.class)).collect(Collectors.toList()));//objList-to-objLists//sourceId:1326456_1
        }


        return retData;
    }
    //
}
